/**
 * @description api配置
 * @author 刘永奇
 */

import request from "../utils/request";
export default {
  login(params) {
    return request({
      url: "/online/login",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  getPermissionList(params) {
    return request({
      url: "/system/menu/tree",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  getRoleList(params) {
    return request({
      url: "/system/role/page",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  getOperationUser(params) {
    return request({
      url: "/system/user/page",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  getRoleAllList(params) {
    return request({
      url: "/system/role/list",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  // 运营账户管理 新增/更新 弹框提交
  userSubmit(params, action) {
    if (action === "add") {
      return request({
        url: "/system/user/add",
        data: params,
        method: "post",
        // mock: true,
      });
    } else if (action === "edit") {
      return request({
        url: "/system/user/update",
        data: params,
        method: "post",
        // mock: true,
      });
    }
  },
  // 删除用户
  userDel(params) {
    return request({
      url: "/system/user/delete",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  resetUserPassword(params) {
    return request({
      url: "/system/user/password",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  changeStatus(params) {
    return request({
      url: "/system/user/status",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 运营商账户管理页面分配角色按钮
  assignRoles(params) {
    return request({
      url: "/system/user/role",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 获取机构树
  getDeptList(params) {
    return request({
      url: "/system/dept/tree",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  getDeptByQuery(params) {
    return request({
      url: "/system/dept/query",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  deleteDept(params) {
    return request({
      url: "/system/dept/delete",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  editDept(params) {
    return request({
      url: "/system/dept/update",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  createDept(params) {
    return request({
      url: "/system/dept/add",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 启用/禁用机构
  changeStatusDept(params) {
    return request({
      url: "/system/dept/status",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 获取产品类别树
  getCategoryTree(params) {
    return request({
      url: "/system/category/tree",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  getCategoryQuery(params) {
    return request({
      url: "/system/category/query",
      data: params,
      method: "get",
      // mock: true,
    });
  },

  // *--------------------         经销商账号管理         --------------------------------------------
  /**
   * 查询经销商账号列表
   * @param {*} params 查询信息
   * @returns
   */
  getSellerAccountList(params) {
    return request({
      url: "/system/dealer/page",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  /**
   * 新增/编辑经销商账号信息
   * @param {*} params 提交参数
   * @param {*} type 提交类型add/edit
   * @returns
   */
  submitSellerMessage(params, type) {
    if (type === "add") {
      return request({
        url: "/system/dealer/add",
        data: params,
        method: "post",
        // mock: true,
      });
    } else if (type === "edit") {
      return request({
        url: "/system/dealer/update",
        data: params,
        method: "post",
        // mock: true,
      });
    }
  },
  /**
   * 删除经销商账号
   * @param {Array} params 删除经销商账号ID
   * @returns
   */
  deleteSellerAccount(params) {
    return request({
      url: "/system/dealer/delete",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  /**
   * 启用禁用经销商账户信息
   * @param {Object} params 启用禁用经销商账户信息
   * @returns
   */
  changeSellerAccountStatus(params) {
    return request({
      url: "/system/dealer/status",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  /**
   * 重置经销商账户密码
   * @param {Object} params 重置经销商账户密码参数
   * @returns
   */
  resetSellerAccountPassword(params) {
    return request({
      url: "/system/dealer/password",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  /**
   * 解除经销商关联
   * @param {Object} params 解除经销商关联信息
   */
  relieveSellerRelevancy(params) {
    return request({
      url: "/system/dealer/relieve",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  /**
   * 经销商关联
   * @param {*} params
   * @returns
   */
  sellerRelevancy(params) {
    return request({
      url: "/system/dealer/contact",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  /**
   * @params {Object} params 获取经销商列表的接口
   */
  sellerList(params) {
    return request({
      url: "/reseller/pagesimple",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  // 添加产品类别
  addCategory(params) {
    return request({
      url: "/system/category/add",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 更新产品类别
  updateCategory(params) {
    return request({
      url: "/system/category/update",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 删除类别f
  deleteCategory(params) {
    return request({
      url: "/system/category/delete",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 更改产品类别状态
  changeStatusCategory(params) {
    return request({
      url: "/system/category/status",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  /**
   * ----------------------------------  菜单  --------------------------------------------------------------
   */
  // 查询菜单
  getMenuQuery(params) {
    return request({
      url: "/system/menu/query",
      data: params,
      method: "get",
      // mock: true,
    });
  },
  // 删除菜单
  deleteMenu(params) {
    return request({
      url: "/system/menu/delete",
      data: params,
      method: "post",
      // mock: true,
    });
  },

  // 添加菜单
  addMenu(params) {
    return request({
      url: "/system/menu/add",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  //更新菜单
  updateMenu(params) {
    return request({
      url: "/system/menu/update",
      data: params,
      method: "post",
      // mock: true,
    });
  },
  // 获取机构信息
  getDeptMessage(params) {
    return request({
      url: "/system/dept/tree",
      data: params,
      method: "get",
      // mock: true,
    });
  },
};
